import java.util.Scanner;

/**
   Counts the number of digits with value 7 in the decimal 
   representation of the integer n
*/
public class CountSevens
{
   public static void main(String[] args)
   {
      Scanner in = new Scanner(System.in);
      int n = in.nextInt();
      String s = n + "";
      int count = 0;
      for(int i = 0; i < s.length(); i++)
      {
         char c = s.charAt(i);
         String a = c + "";
         if(a.equals("7"))
         {
            count++;
         }
      }

      System.out.println(count);
   }
}